package com.site.utils;


import java.util.List;

/*分页*/
public class Page<T> {
    /*总页数*/
    private int totalPageCount = 0;
    /*页面大小，即每页显示记录数*/
    private int pageSize = 30;
    /*记录总数*/
    private int totalCount;
    /*当前页码*/
    private int currPageNo =1;

    private List<T> List;

    public int getTotalPageCount() {
        return totalPageCount;
    }

    public void setTotalPageCount(int totalCount) {
        if (totalCount>0){
            this.totalCount = totalCount;
            /*计算总页数*/
            this.totalPageCount = this.totalCount % pageSize == 0 ? (this.totalCount/pageSize):(this.totalCount/pageSize+1);
        }
    }
    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        if (pageSize>0)
            this.pageSize = pageSize;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getCurrPageNo() {
        if (totalPageCount==0)
            return 0;
        return currPageNo;
    }

    public void setCurrPageNo(int currPageNo) {
        if (currPageNo>0)
            this.currPageNo = currPageNo;
    }

    public List<T> getNewsList() {
        return List;
    }

    public void setNewsList(List<T> List) {
        this.List = List;
    }
}
